package com.tlx.util;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

public class PropUtils {
    
    public static Map<String, String> toMap(String filePath) {
        Map<String, String> result = new HashMap<String, String>();
        ResourceBundle bundle = ResourceBundle.getBundle(filePath, Locale.CHINA);

        Enumeration<String> enums = bundle.getKeys();
        while (enums.hasMoreElements()) {
            String key = enums.nextElement();
            String value = bundle.getString(key);
            result.put(key, value);
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(toMap("config.config"));
    }
}
